package com.example.apidocserver.infrastructure.util.result;

/**
 * @Author xiyanqiulvgui
 * @Date 2020/9/6 22:15
 * @Description 返回对象工具类
 * @Version 1.0.0
 */
public class ResultUtils {

    public static ResultData success(String returnCode, String returnMsg, Object object) {
        return new ResultData(Integer.parseInt(returnCode), returnMsg, object);
    }

    public static ResultData success(int returnCode, String returnMsg, Object object) {
        return new ResultData(returnCode, returnMsg, object);
    }

    public static ResultData success(Object object) {
        return new ResultData(100, "请求成功！", object);

    }

    public static ResultData success() {
        return new ResultData(100, "请求成功！", null);

    }


    public static ResultData failure(String returnCode, String returnMsg, Object object) {
        return new ResultData(Integer.parseInt(returnCode), returnMsg, object);
    }

    public static ResultData failure(String returnCode, String returnMsg) {
        return new ResultData(Integer.parseInt(returnCode), returnMsg, null);
    }

    public static ResultData failure(int returnCode, String returnMsg) {
        return new ResultData(returnCode, returnMsg, null);
    }


    public static ResultData failure(String returnMsg) {
        return new ResultData(201, returnMsg, null);
    }

    public static ResultData failure() {
        return new ResultData(201, "请求失败！", null);
    }
}
